﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
using LdExpress;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
    public string ContainerPage = "./Annoucement.aspx";
    public string strCondition = "";
    public string strPager = "";
    public string strError = "";
    public string strMess = "";
    public string type = "";
    public int nPermissions = 0;
    public string strProcessName = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["logined_id"] != null)
        {
            nPermissions = int.Parse(Session["Annoucement"].ToString());
            if (nPermissions <= 0) Response.Redirect("Login.aspx");
        }
        else
            Response.Redirect("Login.aspx");
        if (!Page.IsPostBack)
        {
            LoadAnnoucement();
            if (nPermissions < 3)
            {
                btnSave.Visible = false;
                btnShowHide.Visible = false;
            }
        }

    }
    protected void LoadAnnoucement()
    {

        Annoucement obj = new Annoucement();
        int lType = 0;
        obj.Load(lType, GV.cn, GV.trans);
        txtProcessDescriptions.Text = obj.Description;
        lblDisplay.Text = obj.Description;
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {

        long userID = long.Parse(Session["logined_id"].ToString());
        Annoucement obj = new Annoucement();
        int lType = 0;
        obj.Load(lType, GV.cn, GV.trans);
        obj.Type = lType;
        obj.UserID = userID;
        obj.Description = txtProcessDescriptions.Text;
        obj.Save(GV.cn, GV.trans);
        lblDisplay.Text = txtProcessDescriptions.Text;
    }
}
